package com.shortvedio.media.config;

import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.util.Auth;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;


@Component   //七牛云相关的容器bean
public class ConfigurationConfig {

    @Value("${qiniu.accessKey}")
    private String accessKey;

    @Value("${qiniu.secretKey}")
    private String secretKey;

    @Bean
    public Configuration configuration(){
        return new Configuration(Region.region2());
    }

    @Bean
    public Auth auth(){
        return Auth.create(accessKey, secretKey);
    }
}
